#define _CRT_SECURE_NO_WARNINGS 1
#include"Test.h"

void Stack::Init() {
	a = nullptr;
	top = capacity = 0;
}
void Stack::Push(int x) {
	if (top == capacity) {
		int newcapacity = capacity == 0 ? 4 : capacity * 2;
		a = (int*)realloc(a, sizeof(int) * newcapacity);
		capacity = newcapacity;
	}
	a[top++] = x;
}
int Stack::Top() {
	return a[top - 1];
}
